package com.kaikeba.t31.dao;

import com.kaikeba.t31.admin.po.AdminRole;
import com.kaikeba.t31.admin.po.AdminUser;
import com.kaikeba.t31.core.dao.ICrudDao;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author yumingzhi
 * @since 2021-11-14
 */
public interface AdminUserMapper extends ICrudDao<AdminUser> {

    /**
     * 根据id锁定
     *
     * @param id
     * @return
     */
    int lock(@Param("id") Long id);

    AdminUser selectById (@Param("id") Long id);

    AdminUser getByName(@Param("name") String name);

    int insert(AdminUser entity);

    int updateById(AdminUser entity);

    List<AdminUser> selectList(AdminUser entity);

    List<AdminRole> selectRoleByUser(@Param("id") Long id);

    void deleteRoleByUser(@Param("userId") Long userId);

    void insertRoleAndUser(@Param("roleId") Long roleId, @Param("userId") Long userId);
}
